//
//  Vertex.swift
//  SwiftyDSA
//
//  Created by Archer on 2018/8/15.
//  Copyright © 2018年 Archer. All rights reserved.
//

import Foundation

/// 访问状态
public enum VStatus {
    case undiscovered
    case discovered
    case visited
}

/// 图的顶点
public final class Vertex<E> {
    
    /// 数据
    var data: E
    /// 入度
    var inDegree: Int
    /// 出度
    var outDegree: Int
    /// 访问状态
    var status: VStatus
    /// 时间标签
    var dTime: Int
    var fTime: Int
    /// 在遍历树中的父节点
    var parent: Int
    /// 在遍历树中的优先级（最短通路、极短跨边等）
    var priority: Int
    
    init(_ value: E) {
        data = value
        inDegree = 0
        outDegree = 0
        status = .undiscovered
        dTime = -1
        fTime = -1
        parent = -1
        priority = Int.max
    }
}
